<form class="form-horizontal" name="port_form" ng-submit="do_upsert()">
    <div class="modal-header">
        <a class="close" ng-click="close()">&times;</a>

        <div class="input-prepend input-append">
            <h4>{{ title }}</h4>
        </div>
    </div>
    <div class="modal-body">
        <div class="control-group">
            <label class="control-label">协议：</label>
            <div class="controls">
                <select class="span2" ng-model="securityrule.protocol" ng-options="t.name for t in portocols">
                </select>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">优先级：</label>

            <div class="controls">
                <input class="input-mini" ng-model="securityrule.priority" type="text" min="1" required/> (1~800)
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">所属组：</label>
            <div class="controls">
                <select class="span2" ng-model="securityrule.group" ng-options="t.name for t in groups" required>
                </select>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">数据流向：</label>

            <div class="controls">
                <select class="span2" ng-change="directionChange()" ng-model="securityrule.direction" ng-options="t.name for t in directions">
                </select>
            </div>
        </div>
        <div class="control-group">
            <div class="controls" id="oneway">
                <div class="form-inline">
                    <label id="onewayIP" style="width: 60px;">{{ iptitle }}:</label>
                    <input type="text" ng-model="securityrule.dstipfrom" class="input-small" ipcheck>
                    <label >到</label>
                    <input type="text" ng-model="securityrule.dstipto" class="input-small" ipcheck>
                    <span style="display:none; color:red" ng-show="port_form.$error.ipcheck">非法的IP地址格式!</span>
                </div>


                <div class="form-inline">
                    <label  id="onewayPort" style="width: 60px;">{{ porttitle }}:</label>
                    <input type="text" ng-model="securityrule.dstportstart" class="input-small" min="0" max="65535">
                    <label >到</label>
                    <input type="text" ng-model="securityrule.dstportend" class="input-small" min="0" max="65535">
                    <span style="display:none; color:red" ng-show="port_related_check">终止端口不能小于起始端口!</span>
                </div>
            </div>
        </div>
    </div>
    <div class="modal-footer">
        <a data-dismiss="modal" class="btn" ng-click="close()">关闭</a>
        <button type="submit" ng-disabled="!port_form.$valid" class="btn btn-primary">保存</button>
    </div>
</form>